package com.toppitch.site.data;

public class BaseData {
	protected String toInsertString(String tablename, Object... values) {
		StringBuilder buff = new StringBuilder();
		buff.append("insert into ").append(tablename).append(" values(");
		for (int i = 0; i < values.length; ++i) {
			if (values[i] instanceof Number) {
				buff.append(values[i]);
			} else {
				buff.append("'").append((String.valueOf(values[i])).replace("'", "''")).append("'");
			}
			if (i != values.length - 1) {
				buff.append(", ");
			}
		}
		buff.append(")");
		return buff.toString();
	}
}
